package com.yonyou.lexue.lexuemgr.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.yonyou.lexue.lexuemgr.entity.Comment;

public interface CommentDao extends PagingAndSortingRepository<Comment, Long> {
	List<Comment> findByUserIdAndCourseId(String userId,String courseId);
	
	@Query(value="select c.* from lexue_comment c where c.course_id=:courseId limit :pageNumber,:pageSize order by c.createDate desc",nativeQuery=true)
	List<Comment> findComments(@Param("pageNumber")Integer pageNumber, @Param("pageSize")Integer pageSize,@Param("courseId")String courseId);
}
